


#ifndef PF_DIMANGULAR_H
#define PF_DIMANGULAR_H

#include "pf_dimension.h"
#include "lx_Export.h"
/**
 * Holds the data that defines a angular dimension entity.
 */
class LX_EXPORT PF_DimAngularAttribute {
public:
    /**
     * Default constructor. Leaves the data object uninitialized.
     */
    PF_DimAngularAttribute() {}

    /**
     * Constructor with initialisation.
     *
     * @param definitionPoint Definition point of the angular dimension. 
     * @param leader Leader length.
     */
    PF_DimAngularAttribute(const PF_Vector& definitionPoint1,
                      const PF_Vector& definitionPoint2,
					  const PF_Vector& definitionPoint3,
					  const PF_Vector& definitionPoint4) {
        this->definitionPoint1 = definitionPoint1;
        this->definitionPoint2 = definitionPoint2;
        this->definitionPoint3 = definitionPoint3;
        this->definitionPoint4 = definitionPoint4;
    }

    friend std::ostream& operator << (std::ostream& os,
                                      const PF_DimAngularAttribute& dd) {
        os << "(" << dd.definitionPoint1 << "/" << dd.definitionPoint2 << "/"
		          << dd.definitionPoint3 << "/" << dd.definitionPoint3 << ")";
        return os;
    }

public:
    /** Definition point 1. */
    PF_Vector definitionPoint1;
    /** Definition point 2. */
    PF_Vector definitionPoint2;
    /** Definition point 3. */
    PF_Vector definitionPoint3;
    /** Definition point 4. */
    PF_Vector definitionPoint4;
};



/**
 * Class for angular dimension entities.
 *

 */
class LX_EXPORT PF_DimAngular : public PF_Dimension {
public:
    PF_DimAngular(PF_Container* parent,
                 const PF_DimensionAttribute& d,
                 const PF_DimAngularAttribute& ed);
    virtual ~PF_DimAngular() {}

    virtual PF_Entity* clone() {
        PF_DimAngular* d = new PF_DimAngular(*this);
        d->setOwner(isOwner());
        d->initId();
        d->detach();
        return d;
    }

    /**	@return LX_Define::EntityDimAngular */
    virtual LX_Define::EntityType rtti() const {
        return LX_Define::EntityDimAngular;
    }

    /**
     * @return Copy of data that defines the angular dimension. 
     * @see getData()
     */
    PF_DimAngularAttribute getEData() const {
        return edata;
    }

    virtual QString getMeasuredLabel();
    double getAngle();
    PF_Vector getCenter();
	bool getAngles(double& ang1, double& ang2, bool& reversed,
		PF_Vector& p1, PF_Vector& p2);

    virtual void update(bool autoText=false);

    PF_Vector getDefinitionPoint1() {
        return edata.definitionPoint1;
    }
    PF_Vector getDefinitionPoint2() {
        return edata.definitionPoint2;
    }
    PF_Vector getDefinitionPoint3() {
        return edata.definitionPoint3;
    }
    PF_Vector getDefinitionPoint4() {
        return edata.definitionPoint4;
    }

    virtual void move(PF_Vector offset);
    virtual void rotate(PF_Vector center, double angle);
    virtual void scale(PF_Vector center, PF_Vector factor);
    virtual void mirror(PF_Vector axisPoint1, PF_Vector axisPoint2);

    friend std::ostream& operator << (std::ostream& os,
                                      const PF_DimAngular& d);

protected:
    /** Extended data. */
    PF_DimAngularAttribute edata;
};

#endif
